package com.mangofactory.aop.joinpoints
{
	import org.as3commons.bytecode.interception.IMethodInvocation;
	import org.as3commons.bytecode.interception.InvocationKind;

	public class MethodInvokingJoinPoint implements ProceedingJoinPoint
	{
		private var invocation:IMethodInvocation;
		
		public function MethodInvokingJoinPoint(invocation:IMethodInvocation)
		{
			this.invocation = invocation;
		}
		
		public function proceed():void
		{
			invocation.returnValue = invocation.targetMethod.apply(invocation.targetInstance,invocation.arguments);
		}

		public function get kind():InvocationKind
		{
			return invocation.kind;
		}

		public function get arguments():Array
		{
			return invocation.arguments;
		}

		public function get targetInstance():Object
		{
			return invocation.targetInstance;
		}

		public function get targetMember():QName
		{
			return invocation.targetMember;
		}

		public function get returnValue():*
		{
			return invocation.returnValue;
		}

		public function set returnValue(value:*):void
		{
			invocation.returnValue = value;
		}
	}
}